home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
076-100
/
094
/
audiotools
/
audiotools.doc
next >
Wrap
Text File
|
1995-03-13
|
3KB
|
94 lines
RELEASE 2 - AUDIO TOOLS - DOCUMENTATION
---------------------------------------
The RELEASE.2 directory contains the source and executable program
for the second release of the audio tools, called audiotools2.c.
The example program is called rel2.demo.c.
It includes the following functions that are designed to be used by
the casual user as well as a developer. A one-line description is
provided here, with complete documentation for each following later
in this document.
The functions:
port = InitAudio() initialize the audio routines, get a port
for receiving messages from audio routines
channel = GetChannel(type) request a channel to use.
error = FreeChannel(channel) free a channel that you have been given.
FinishAudio(port) end the use of audio routines and return
the port you received from audio routines
error = StopChannel(channel) temporarily halt a channel you own
error = StartChannel(channel) start your channel up again.
error = FlushChannel(channel) empty the queue of a channel from any notes
it is playing or is going to play.
error = ResetChannel(channel) reset a channel
PlayNote( ... parameters ...) queue up a specific note number to be played
by one of your channels.
PlayFreq( ... parameters ...) queue up a specific frequency instead of note.
IsThatMyChan(channel) see if your task still owns a particular
channel (audio system allows stealing of
channels if they are not locked at a high
enough priority).
note = MayGetNote(port, flag) see if a note you marked has begun to play.
possibly put task to sleep if it has not.
good for synchronizing graphics and sound.
SetPV(channel,per,vol) Set the period and/or volume of a channel
that is already playing a waveform. Limited
use (except for volume, that is; see the
article text to see why you may not want to
use this routine to set the period. In fact,
I will probably add routines that do volume
and period separately - routine has to
be able to read what is now playing to
be able to modify it properly.)
USING THE ROUTINES
------------------
To use the routines, the proper minimal code sequence is:
1. Declare a pointer to a message port:
struct MsgPort *myport;
2. Declare a LONG integer variable to hold a channel number:
LONG channel;
3. Initialize the audio routines, if successful, the init
returns a pointer to a message port:
myport = InitAudio();
4. Get a channel to use for your output:
channel = GetChannel(-1);
where -1 means "any" available channel,
0, 1, 2, or 3 means a specific channel.
If a value of 0, 1, 2, or 3 is returned,
you have that channel to use.
5. Choose a note or frequency to play, and its duration,
the waveform to use, and so on (see detailed
descriptions of PlayNote and PlayFreq).
error = PlayNote(... parameters ...);
or
error = PlayFreq(... parameters ...);